package frsf.cidisi.exercise.arqueologo.search;

import frsf.cidisi.faia.solver.search.IEstimatedCostFunction;
import frsf.cidisi.faia.solver.search.NTree;

/**
 * This class allows to define a function to be used by any
 * informed search strategy, like A Star or Greedy.
 */
public class Heuristic implements IEstimatedCostFunction {

    /**
     * It returns the estimated cost to reach the goal from a NTree node.
     */
    public double getEstimatedCost(NTree node) {
        ArqueologoAgentState agState = (ArqueologoAgentState) node.getAgentState();
        //En el caso de que la distancia recorrida sea 0, significa que estamos en el destino.
        if(agState.getDistMin() != 0){
        	return -1 * (agState.getmundo().getTesoroRemanente() / agState.getDistMin());
        }else{
        	return -1 * (agState.getmundo().getTesoroRemanente());
        }
    }
}
